import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:toast/toast.dart';

class MeetingTool {
  static toast(text, BuildContext context) {
    ToastContext().init(context);
    Toast.show(text);
  }

  /// 一屏显示6个用户
  static int screenLen = 6;
  static getScreenList(list) {
    int len = screenLen;
    List<List> result = [];
    int index = 1;
    while (true) {
      if (index * len < list.length) {
        List temp = list.skip((index - 1) * len).take(len).toList();
        result.add(temp);
        index++;
        continue;
      }
      List temp = list.skip((index - 1) * len).toList();
      result.add(temp);
      break;
    }
    return result;
  }

  static Size getViewSize(
      Size screenSize, int listLength, int index, int total) {
    if (screenSize.width > screenSize.height) {
      return Size(screenSize.width / 3, screenSize.height / 2);
    }
    return Size(screenSize.width / 2, screenSize.height / 3);
  }
}